﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Linq.Expressions;
using System.Text;
using System.Threading.Tasks;

namespace MTQ.Common
{
    public class ExpressionLambda
    {

        public static Expression<Func<T, To>> GetSortExpression<T, To>(String sortBy)
        {

            var param = Expression.Parameter(typeof(T), "x");

            Expression expr = Expression.Property(param, sortBy);

            return Expression.Lambda<Func<T, To>>(expr, param); ;

        }
    }
}
